import React, { Component } from 'react'

export default class TemperaturInput extends Component {
  handleInputChange(e) {
    this.props.onTemperatureChange(e.target.value);
  }

  render() {
    const temperature = this.props.temperature;
    const scale = this.props.scale;
    return (
      <div className='temperatur-input'>
        <fieldset>
          <legend>Enter temperature in { scale }</legend>
          <input value={ temperature } onChange={ (e) => { this.handleInputChange(e) } } />
        </fieldset>
      </div>
    )
  }
}
